<template>
    <div class="father">
        <h3>父组件</h3>
        <!-- 可以传递方法给任何组件 -->
        <Child v-bind="{userName,age,add}"></Child>
        <input v-model="userName">
    </div>
</template>

<script setup lang="ts" name="Attr">
import { ref } from 'vue';
import Child from "@/components/demo5/Child.vue";


let userName = ref('保时捷')
let age = ref(20)

//自定义传递方法
function add(nu:any) {
    age.value += nu;
}
</script>

<style scoped>
.father {
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
}
</style>
